import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;

public class SplashForm extends Form implements CommandListener
{
	private MenuManager menuMgr;
	private Command first;
	private Command second;
	private Command third;
	
	public SplashForm(MenuManager mngr, String title)
	{
		super(title);
		this.menuMgr = mngr;
		this.setCommandListener(this);
	}
	
	/* Three commands support only */
	public void addCommand(Command c)
	{
		if(this.first == null)
			this.first = c;
		else if(this.second == null)
			this.second = c;
		else if(this.third == null)
			this.third = c;
		else
			return;
		super.addCommand(c);
	}
	
	public void removeCommand(Command toRemove)
	{
		/* fail */
	}
	
	public void commandAction(Command c, Displayable d)
	{
		if(c == first)
			menuMgr.itemSelected(0);
		else if(c == second)
			menuMgr.itemSelected(1);
		else if(c == third)
			menuMgr.itemSelected(2);
	}
}
